package b2.scene.fight.skills
{
	import b2.util.Profile;
	
	import flash.geom.Point;
	
	public class SkillPosition
	{
		private var x:int;
		private var y:int;
		private var direction:int;
		
		private var points:Array;
		public function SkillPosition(x:int, y:int, direction:int = 0)
		{
			this.x = x;
			this.y = y;
			this.direction = direction;
			points = new Array();
		}
		
		//获取实际的位置 
		public function addPoint(relativeX:int, relativeY:int):void
		{
			
			var result:Point = transPoint(relativeX, relativeY);
			
			points.push(result);
		}
		
		public function getPoints():Array
		{
			//debug
			if (Profile.DEBUG == 1)
				draw();
			return points;
		}
		
		public function transPoint(relativeX:int, relativeY:int):Point
		{
			var result:Point = new Point();
			
			if (direction == 0)
			{
				result.x = x + relativeX;
				result.y = y - relativeY;
			}
			else if (direction == 1)
			{
				result.x = x + relativeY;
				result.y = y + relativeX;
			}
			else if (direction == 2)
			{
				result.x = x - relativeX;
				result.y = y + relativeY;
			}
			else if (direction == 3)
			{
				result.x = x - relativeY;
				result.y = y - relativeX;
			}
			return result;
		} 

		//debug 调试画点
		private function draw(time:int = 10):void
		{
			
		}
	}
}